import React from 'react';
let echarts = require('echarts');
class MyEchart extends React.Component {
  render() {
    console.log(this.props)
    let {id,sheetStyle} = this.props
    console.log(id)
    return (
      <div style={sheetStyle}>
        <div id={id} style={{width: '100%',height: '100%'}}></div>
      </div>
    )
  }
  componentDidMount() {
    let {id,option} = this.props
  
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById(id));
    // 绘制图表
    myChart.setOption(option);
  }
}

export default MyEchart;
